this.item.menu.addMenuItem(this._labelSection);
this.item.menu.addMenuItem(this._radioSection);
- this.connect('icon-changed', Lang.bind(this, this._sync));
+ this._notifyConnectivityId = this._client.connect('notify::connectivity', Lang.bind(this, this._iconChanged));
},
destroy: function() {
+ if (this._notifyConnectivityId != 0) {
+ this._client.disconnect(this._notifyConnectivityId);
+ this._notifyConnectivityId = 0;
+ }
+
this.item.destroy();
},
+ _iconChanged: function() {
+ this._sync();
+ this.emit('icon-changed');
+ },
+
_sync: function() {
let nItems = this._connectionItems.size;
return;
item.connect('icon-changed', Lang.bind(this, function() {
- this.emit('icon-changed');
+ this._iconChanged();
}));
item.connect('activation-failed', Lang.bind(this, function(item, reason) {
this.emit('activation-failed', reason);
if (this._mobileDevice) {
this._operatorNameId = this._mobileDevice.connect('notify::operator-name', Lang.bind(this, this._sync));
this._signalQualityId = this._mobileDevice.connect('notify::signal-quality', Lang.bind(this, function() {
- this.emit('icon-changed');
+ this._iconChanged();
}));
}
},
this._wirelessHwEnabledChangedId = this._client.connect('notify::wireless-hardware-enabled', Lang.bind(this, this._sync));
this._activeApChangedId = this._device.connect('notify::active-access-point', Lang.bind(this, this._activeApChanged));
this._stateChangedId = this._device.connect('state-changed', Lang.bind(this, this._deviceStateChanged));
+ this._notifyConnectivityId = this._client.connect('notify::connectivity', Lang.bind(this, this._iconChanged));
this._sync();
},
+ _iconChanged: function() {
+ this._sync();
+ this.emit('icon-changed');
+ },
+
destroy: function() {
if (this._activeApChangedId) {
GObject.Object.prototype.disconnect.call(this._device, this._activeApChangedId);
this._dialog.destroy();
this._dialog = null;
}
+ if (this._notifyConnectivityId) {
+ this._client.disconnect(this._notifyConnectivityId);
+ this._notifyConnectivityId = 0;
+ }
this.item.destroy();
},
},
_strengthChanged: function() {
- this.emit('icon-changed');
+ this._iconChanged();
},
_activeApChanged: function() {